package com.qf.controller;

import com.qf.pojo.Customer;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

/**
 * 测试 对外暴露的接口
 * @author lixu
 */
@RestController
@RequestMapping("/search")
public class HelloController {

    @Value("${server.port}")
    private String serverPort;

    /**
     * 搜索微服务
     * http://localhost:9002/search/list?name=张三
     */
    @GetMapping("/list")
    public String list(@RequestParam(value = "name") String name){

        return "我是搜索微服务!!!欢迎你的访问！！！！:" + serverPort + ":::" + name;
    }

    /**
     * 搜索微服务

     *   3、@PathVariable(value = "name") String name
     *   http://localhost:9001/customer/pathFeign/xiaoxiao
     */
    @GetMapping("/pathFeign/{name}")
    public String pathFeign(@PathVariable String name){
        return "我是搜索微服务!pathFeign:" + serverPort + ":::" + name;
    }

    /**
     * http://localhost:9001/search/pojo
     *  POST
     * @param customer
     * @return
     */
    @PostMapping("/pojo")
    public String pojo(@RequestBody Customer customer){


        return "我是搜索微服务!pojo::::" + customer;
    }
}
